package com.jxufe.weather;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

public class WeaBean implements Writable {
	private Integer cityid;
	private Integer week;
//	private String city;
	private Double tem1;
	private Double tem2;
	private Double tem;

	public WeaBean() {
		super();
	}

	public WeaBean(Integer cityid, Integer week, Double tem1, Double tem2, Double tem) {
		super();
		this.cityid = cityid;
		this.week = week;
//		this.city = city;
		this.tem1 = tem1;
		this.tem2 = tem2;
		this.tem = tem;
	}

	public void write(DataOutput out) throws IOException {
//		out.write(cityid.getBytes());
//		out.write(week.getBytes());
//		out.write(city.getBytes());
//		out.write(tem1.getBytes());
//		out.write(tem2.getBytes());
//		out.write(tem.getBytes());
		
		//String类型的写入和读取方法：
//		Text.writeString(out, city); 
//		String s = Text.readString(in);
		
		out.writeInt(cityid);
		out.writeInt(week);
//		out.writeBytes(city);
		out.writeDouble(tem1);
		out.writeDouble(tem2);
		out.writeDouble(tem);
	}

	public void readFields(DataInput in) throws IOException {
		this.cityid = in.readInt();
		this.week = in.readInt();
//		this.city = in.readLine();
		this.tem1 = in.readDouble();
		this.tem2 = in.readDouble();
		this.tem = in.readDouble();
	}

	public Integer getCityid() {
		return cityid;
	}

	public void setCityid(Integer cityid) {
		this.cityid = cityid;
	}

	public Integer getWeek() {
		return week;
	}

	public void setWeek(Integer week) {
		this.week = week;
	}

//	public String getCity() {
//		return city;
//	}
//
//	public void setCity(String city) {
//		this.city = city;
//	}

	public Double getTem1() {
		return tem1;
	}

	public void setTem1(Double tem1) {
		this.tem1 = tem1;
	}

	public Double getTem2() {
		return tem2;
	}

	public void setTem2(Double tem2) {
		this.tem2 = tem2;
	}

	public Double getTem() {
		return tem;
	}

	public void setTem(Double tem) {
		this.tem = tem;
	}

	@Override
	public String toString() {
		return "WeaBean [cityid=" + cityid + ", week=" + week + ", tem1=" + tem1 + ", tem2=" + tem2 + ", tem=" + tem
				+ "]";
	}

	
	

}
